FROM golang:1.11-alpine AS builder

RUN sed -i "s|http://dl-cdn.alpinelinux.org|https://mirrors.aliyun.com|g" /etc/apk/repositories \
 && apk update \
 && apk add tzdata \
 && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


COPY . /go/src/gitee.com/iexception007/nats-tester
WORKDIR /go/src/gitee.com/iexception007/nats-tester
RUN  mkdir -p /app/usr/bin/ \
  && mkdir -p /app/etc/ \
  && CGO_ENABLED=0 go build -o /app/usr/bin/nats-tester \
  && cp /etc/localtime /app/etc/localtime \
  && chmod +x /app/usr/bin/nats-tester

#CMD nats-tester
FROM alpine:3.9
COPY --from=builder /app/ /
CMD nats-tester